<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class Gem::OptionParser::List - rubygems: Ruby Standard Library Documentation</title>


<script src="../../js/navigation.js" defer></script>
<script src="../../js/search.js" defer></script>
<script src="../../js/search_index.js" defer></script>
<script src="../../js/searcher.js" defer></script>
<script src="../../js/darkfish.js" defer></script>

<script src="../../js/jquery-3.2.0.min.js"></script>

<script src="../../js/vue.min.js"></script>
<script src="../../js/js.cookie.min.js"></script>

<link href="../../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../../css/rdoc.css" rel="stylesheet">
<link href="../../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../../";
  var index_rel_prefix = "../../";
  var darkModeCsseHref = "../../css/rdoc-dm.css"
  var defaultModeCssHref = "../../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../../table_of_contents.html#pages">Pages</a>
    <a href="../../table_of_contents.html#classes">Classes</a>
    <a href="../../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link">Object
</div>

        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-new">::new</a>
    <li ><a href="#method-i-accept">#accept</a>
    <li ><a href="#method-i-append">#append</a>
    <li ><a href="#method-i-complete">#complete</a>
    <li ><a href="#method-i-each_option">#each_option</a>
    <li ><a href="#method-i-get_candidates">#get_candidates</a>
    <li ><a href="#method-i-prepend">#prepend</a>
    <li ><a href="#method-i-reject">#reject</a>
    <li ><a href="#method-i-search">#search</a>
    <li ><a href="#method-i-summarize">#summarize</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-Gem::OptionParser::List">
    <h1 id="class-Gem::OptionParser::List" class="class">
      class Gem::OptionParser::List
    </h1>

    <section class="description">
    
<p>Simple option list providing mapping from short and/or long option string to <a href="Switch.html"><code>Gem::OptionParser::Switch</code></a> and mapping from acceptable argument to matching pattern and converter pair. Also provides summary feature.</p>

    </section>

      <section id="5Buntitled-5D" class="documentation-section">



        <section class="attribute-method-details" class="method-section">
        <header>
        <h3>Attributes</h3>
        </header>

          <div id="attribute-i-atype" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">atype</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>Map from acceptable argument types to pattern and converter pairs.</p>
              </div>
            </div>
          <div id="attribute-i-list" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">list</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p><a href="List.html"><code>List</code></a> of all switches and summary string.</p>
              </div>
            </div>
          <div id="attribute-i-long" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">long</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>Map from long style option switches to actual switch objects.</p>
              </div>
            </div>
          <div id="attribute-i-short" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">short</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>Map from short style option switches to actual switch objects.</p>
              </div>
            </div>
            </section>


                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-new" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">new</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Just initializes all instance variables.</p>

                              <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File rubygems/optparse/lib/optparse.rb, line 816</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>
  <span class="ruby-ivar">@atype</span> = {}
  <span class="ruby-ivar">@short</span> = <span class="ruby-constant">OptionMap</span>.<span class="ruby-identifier">new</span>
  <span class="ruby-ivar">@long</span> = <span class="ruby-constant">OptionMap</span>.<span class="ruby-identifier">new</span>
  <span class="ruby-ivar">@list</span> = []
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-accept" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">accept</span><span
                                class="method-args">(t, pat = /.*/m, &amp;block)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>See <a href="../OptionParser.html#method-c-accept"><code>Gem::OptionParser.accept</code></a>.</p>

                              <div class="method-source-code" id="accept-source">
            <pre><span class="ruby-comment"># File rubygems/optparse/lib/optparse.rb, line 837</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">accept</span>(<span class="ruby-identifier">t</span>, <span class="ruby-identifier">pat</span> = <span class="ruby-regexp">/.*/m</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">pat</span>
    <span class="ruby-identifier">pat</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:match</span>) <span class="ruby-keyword">or</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-string">&quot;has no `match&#39;&quot;</span>, <span class="ruby-constant">ParseError</span>.<span class="ruby-identifier">filter_backtrace</span>(<span class="ruby-identifier">caller</span>(<span class="ruby-value">2</span>))
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">pat</span> = <span class="ruby-identifier">t</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:match</span>)
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">block</span>
    <span class="ruby-identifier">block</span> = <span class="ruby-identifier">pat</span>.<span class="ruby-identifier">method</span>(<span class="ruby-value">:convert</span>).<span class="ruby-identifier">to_proc</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">pat</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:convert</span>)
  <span class="ruby-keyword">end</span>
  <span class="ruby-ivar">@atype</span>[<span class="ruby-identifier">t</span>] = [<span class="ruby-identifier">pat</span>, <span class="ruby-identifier">block</span>]
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-append" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">append</span><span
                                class="method-args">(*args)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Appends <code>switch</code> at the tail of the list, and associates short, long and negated long options. Arguments are:</p>
<dl class="rdoc-list note-list"><dt><code>switch</code>
<dd>
<p><a href="Switch.html"><code>Gem::OptionParser::Switch</code></a> instance to be inserted.</p>
</dd><dt><code>short_opts</code>
<dd>
<p><a href="List.html"><code>List</code></a> of short style options.</p>
</dd><dt><code>long_opts</code>
<dd>
<p><a href="List.html"><code>List</code></a> of long style options.</p>
</dd><dt><code>nolong_opts</code>
<dd>
<p><a href="List.html"><code>List</code></a> of long style options with “no-” prefix.</p>
</dd></dl>

<pre class="ruby"><span class="ruby-identifier">append</span>(<span class="ruby-identifier">switch</span>, <span class="ruby-identifier">short_opts</span>, <span class="ruby-identifier">long_opts</span>, <span class="ruby-identifier">nolong_opts</span>)
</pre>

                              <div class="method-source-code" id="append-source">
            <pre><span class="ruby-comment"># File rubygems/optparse/lib/optparse.rb, line 901</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">append</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
  <span class="ruby-identifier">update</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
  <span class="ruby-ivar">@list</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>])
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-complete" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">complete</span><span
                                class="method-args">(id, opt, icase = false, *pat, &amp;block)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Searches list <code>id</code> for <code>opt</code> and the optional patterns for completion <code>pat</code>. If <code>icase</code> is true, the search is case insensitive. The result is returned or yielded if a block is given. If it isn’t found, nil is returned.</p>

                              <div class="method-source-code" id="complete-source">
            <pre><span class="ruby-comment"># File rubygems/optparse/lib/optparse.rb, line 923</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">complete</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">opt</span>, <span class="ruby-identifier">icase</span> = <span class="ruby-keyword">false</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">pat</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">id</span>).<span class="ruby-identifier">complete</span>(<span class="ruby-identifier">opt</span>, <span class="ruby-identifier">icase</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">pat</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-each_option" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">each_option</span><span
                                class="method-args">(&amp;block)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Iterates over each option, passing the option to the <code>block</code>.</p>

                              <div class="method-source-code" id="each_option-source">
            <pre><span class="ruby-comment"># File rubygems/optparse/lib/optparse.rb, line 934</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">each_option</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">list</span>.<span class="ruby-identifier">each</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-get_candidates" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">get_candidates</span><span
                                class="method-args">(id) { |__send__(id).keys| ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="get_candidates-source">
            <pre><span class="ruby-comment"># File rubygems/optparse/lib/optparse.rb, line 927</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_candidates</span>(<span class="ruby-identifier">id</span>)
  <span class="ruby-keyword">yield</span> <span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">id</span>).<span class="ruby-identifier">keys</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-prepend" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">prepend</span><span
                                class="method-args">(*args)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Inserts <code>switch</code> at the head of the list, and associates short, long and negated long options. Arguments are:</p>
<dl class="rdoc-list note-list"><dt><code>switch</code>
<dd>
<p><a href="Switch.html"><code>Gem::OptionParser::Switch</code></a> instance to be inserted.</p>
</dd><dt><code>short_opts</code>
<dd>
<p><a href="List.html"><code>List</code></a> of short style options.</p>
</dd><dt><code>long_opts</code>
<dd>
<p><a href="List.html"><code>List</code></a> of long style options.</p>
</dd><dt><code>nolong_opts</code>
<dd>
<p><a href="List.html"><code>List</code></a> of long style options with “no-” prefix.</p>
</dd></dl>

<pre class="ruby"><span class="ruby-identifier">prepend</span>(<span class="ruby-identifier">switch</span>, <span class="ruby-identifier">short_opts</span>, <span class="ruby-identifier">long_opts</span>, <span class="ruby-identifier">nolong_opts</span>)
</pre>

                              <div class="method-source-code" id="prepend-source">
            <pre><span class="ruby-comment"># File rubygems/optparse/lib/optparse.rb, line 885</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">prepend</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
  <span class="ruby-identifier">update</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
  <span class="ruby-ivar">@list</span>.<span class="ruby-identifier">unshift</span>(<span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>])
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-reject" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">reject</span><span
                                class="method-args">(t)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>See <a href="../OptionParser.html#method-c-reject"><code>Gem::OptionParser.reject</code></a>.</p>

                              <div class="method-source-code" id="reject-source">
            <pre><span class="ruby-comment"># File rubygems/optparse/lib/optparse.rb, line 853</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">reject</span>(<span class="ruby-identifier">t</span>)
  <span class="ruby-ivar">@atype</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">t</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-search" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">search</span><span
                                class="method-args">(id, key) { |val| ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Searches <code>key</code> in <code>id</code> list. The result is returned or yielded if a block is given. If it isn’t found, nil is returned.</p>

                              <div class="method-source-code" id="search-source">
            <pre><span class="ruby-comment"># File rubygems/optparse/lib/optparse.rb, line 910</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">search</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">key</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">list</span> = <span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">id</span>)
    <span class="ruby-identifier">val</span> = <span class="ruby-identifier">list</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">key</span>) {<span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span>}
    <span class="ruby-identifier">block_given?</span> <span class="ruby-operator">?</span> <span class="ruby-keyword">yield</span>(<span class="ruby-identifier">val</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">val</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-summarize" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">summarize</span><span
                                class="method-args">(*args, &amp;block)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Creates the summary table, passing each line to the <code>block</code> (without newline). The arguments <code>args</code> are passed along to the summarize method which is called on every option.</p>

                              <div class="method-source-code" id="summarize-source">
            <pre><span class="ruby-comment"># File rubygems/optparse/lib/optparse.rb, line 943</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">summarize</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">sum</span> = []
  <span class="ruby-identifier">list</span>.<span class="ruby-identifier">reverse_each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">opt</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">opt</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:summarize</span>) <span class="ruby-comment"># perhaps Gem::OptionParser::Switch</span>
      <span class="ruby-identifier">s</span> = []
      <span class="ruby-identifier">opt</span>.<span class="ruby-identifier">summarize</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">l</span><span class="ruby-operator">|</span> <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">l</span>}
      <span class="ruby-identifier">sum</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">s</span>.<span class="ruby-identifier">reverse</span>)
    <span class="ruby-keyword">elsif</span> <span class="ruby-operator">!</span><span class="ruby-identifier">opt</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">opt</span>.<span class="ruby-identifier">empty?</span>
      <span class="ruby-identifier">sum</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;&quot;</span>
    <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">opt</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:each_line</span>)
      <span class="ruby-identifier">sum</span>.<span class="ruby-identifier">concat</span>([<span class="ruby-operator">*</span><span class="ruby-identifier">opt</span>.<span class="ruby-identifier">each_line</span>].<span class="ruby-identifier">reverse</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">sum</span>.<span class="ruby-identifier">concat</span>([<span class="ruby-operator">*</span><span class="ruby-identifier">opt</span>.<span class="ruby-identifier">each</span>].<span class="ruby-identifier">reverse</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">sum</span>.<span class="ruby-identifier">reverse_each</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>.</p><p><a href="https://jamesbritt.bandcamp.com/">Maximum R+D</a>.  </p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

